package org.yejiali.domain.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/**
 * @Author:yejiali
 * @Date:2025/2/18-02-18-22:03
 * @Decsription:org.yejiali.domain.entity
 * @Version:1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LoginUser implements UserDetails {
    private User user;
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() { //返回权限集合
        return null;
    }

    @Override
    public String getPassword() {
        return user.getPassword();
    }

    @Override
    public String getUsername() {
        return user.getUserName();
    }

    @Override
    public boolean isAccountNonExpired() { //判断是否过期
        return true;
    }

    @Override
    public boolean isAccountNonLocked() { //判断账户是否锁住
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() { //判断是否超时
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
